//
//  sanTabController.m
//  sanFsports
//
//  Created by mac on 16/11/20.
//  Copyright © 2016年 sanAiFuSport.com. All rights reserved.
//

#import "sanTabController.h"
#import "sanNavController.h"
#import "sanHomeViewController.h"
#import "sanXueChViewController.h"
#import "sanXueGViewController.h"
#import "sanMineViewController.h"
@interface sanTabController ()

@end

@implementation sanTabController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //添加子控件器
    UIViewController *homeController = [self controllerWith:@"sanHomeViewController" title:@"首页" imageName:@"TabBar_Friends_Sel"];
    UIViewController *xueChController = [self controllerWith:@"sanXueChViewController" title:@"雪场" imageName:@"TabBar_Friends_Sel"];
    UIViewController *XueGController = [self controllerWith:@"sanXueGViewController" title:@"雪迹" imageName:@"TabBar_Friends_Sel"];
    UIViewController *mineController = [self controllerWith:@"sanMineViewController" title:@"我的" imageName:@"TabBar_Friends_Sel"];
    
    self.viewControllers=@[homeController,xueChController,XueGController,mineController];
    
}


-(UIViewController *)controllerWith:(NSString *)className title:(NSString *)title imageName:(NSString *)imageName{
    Class clz = NSClassFromString(className);
    UIViewController *controller = [[clz alloc]init];
    
    controller.tabBarItem.title = title;
    controller.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    controller.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@_Sel",imageName]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    sanNavController *navController = [[sanNavController alloc]initWithRootViewController:controller];
    
    
    return navController;
}

@end
